<template>
	<view class="container">
		<view class="v-header">
			<view class="v-header-title">{{datas.ContentInfo.Title}}</view>
			<view class="v-header-sec-title">{{datas.ContentInfo.CreateTime}}</view>
		</view>
		<view class="v-content" v-html="datas.ContentInfo.Content"></view>
	</view>
</template>

<script>
	import {
		dateUtils,
		authTokenUtil,
		validLoginToken
	} from "../../common/util.js"
	export default {
		data() {
			return {
				datas: {
					// 富文本数据
					ContentInfo: {
						Id: '',
						Title: '',
						ImageUrl: '',
						Content: '',
						CreateTime: ''
					},
				}
			};
		},
		methods: {
			init: function() {
				let _this = this;
				console.log('init');

				uni.getStorage({
					key: 'CurrentCms',
					success: (res) => {
						if (res) {
							console.log(res);
							_this.datas.ContentInfo = res.data;
						}
					},
					fail: (error) => {
						console.log(error);
					}
				});
			}
		},
		onShow() {
			let _this = this;
			_this.init();
		},
		created() {
			let _this = this;
			validLoginToken(null, () => {
				uni.reLaunch({
					url: "/pages/account/login"
				})
			})
			// _this.init();
		}
	};
</script>

<style>
	.container {
		display: flex;
		flex-direction: column;
		justify-content: flex-start;
		align-items: stretch;
		heigth: 100%;
		width: 100%;
		padding: 20rpx;
		box-sizing: border-box;
	}

	.v-header {
		display: flex;
		flex-direction: column;
		justify-content: flex-start;
		align-items: stretch;
		border-bottom: solid 1px #999;
	}

	.v-header-title {
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		font-size: 36rpx;
		color: #333;
		height: 80rpx;
	}

	.v-header-sec-title {
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: flex-end;
		font-size: 26rpx;
		color: #666;
		height: 80rpx;
	}

	.v-content {
		display: flex;
		flex-direction: column;
		justify-content: flex-start;
		align-items: stretch;
		margin-top: 50rpx;
	}
</style>